@extends('new.layouts.indexPublic')
@section('title'){{$find_job.'_'.Site::get('webname')}} @endsection

{{--简历详情页css--}}
@section('headcss')
    <meta name="keywords" content="{{Site::get('homekeywords')}}">
    <meta name="description" content="{{Site::get('homedescription')}}">
    @parent
    <link rel="stylesheet" href="{{asset('/vendor/jedate/skin/jedate.css')}}">
    <link rel="stylesheet" href="{{asset('/new/css/index/resume.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/swiper/skin/swiper2.7.6.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--主导航--}}
    @include('new.layouts.mainNav')
    {{--主导航结束--}}

    {{--主要内容--}}
    <div class="main">
        <div class="wrapper">
            {{--主要内容-简历信息--}}
            {{--基本信息--}}
            <div class="baseInfo">
                <div class="myPhoto">
                    <img src="{{asset($reArr['avatar'])}}" alt="简历详情头像" width="123" height="123">
                </div>
                <div class="bg"></div>
                <p class="name">
                    <span class="float_l">
                            @if(!auth()->guard('company')->check())
                            @if($reArr['sex'] == '男')
                                {{ mb_substr($reArr['name'],0,1)}}先生
                            @else
                                {{ mb_substr($reArr['name'],0,1)}}女士
                            @endif
                        @else
                            {{ $reArr['name']}}
                        @endif
                    </span>
                </p>
                <ul class="detail1">
                    <li>{{ $reArr['sex']}}</li>
                    <li class="vLine"></li>
                    <li>{{ $reArr['birthday']}}</li>
                    <li class="vLine"></li>
                    <li>{{ $reArr['education']}}</li>
                    <li class="vLine"></li>
                    <li>{{ $reArr['work_year']}}</li>
                    <li class="vLine"></li>
                    <li>{{ $reArr['height'] }}</li>
                    <li class="vLine"></li>
                    <li>{{ $reArr['marital'] }}</li>
                </ul>
                <ul class="detail2">
                    <li><span>户 籍<i></i></span>{{ $reArr['census'] }}</li>
                    <li><span>现居<i></i></span>{{ $reArr['homeaddress'] }}</li>
                </ul>
                <ul class="detail2">
                    @if(($lookStatus == 1 || $lookStatus == 2) && Auth::guard('company')->check())
                        <li><span>电话号码</span>{{ $reArr['mobile']}}</li>
                        <li><span>电子邮箱</span>{{ $reArr['email']}}</li>
                        <li><span>QQ号码<i></i></span>{{ $reArr['qq'] }}</li>
                    @elseif(Auth::guard('company')->check() && $user->resumeNumber() )
                        <li><span>温馨提示</span>您的简历数还有<b>{{$user->resumeNumber()}}</b>份。</li>
                    @elseif(Auth::guard('company')->check())
                        <li><span>温馨提示</span>您的简历数还有<b>0</b>份。<a href="">马上充值>></a></li>
                    @endif
                    @if($lookStatus == 0)
                        <li class="seeContact">
                            <button class="{{ $look_button }}">查看联系方式</button>
                        </li>
                    @endif
                </ul>
            </div>

            {{--侧边栏--}}
            <div class="aside">
                {{--操作--}}
                <ul class="action">
                    <li class="invite {{ $interview_button }}">邀请面试</li>
                    <li class="joinTalentPools {{ $insertPersonnelLibrary_button }}">{{ $insertPersonnelLibrary_text }}</li>
                    @if(Auth::guard('company')->check())
                        @if(Auth::guard('company')->user()->resumeNumber() > 1)
                            <li class="resumeDown">简历下载</li>
                        @else
                            <li class="resumeBuy">简历下载</li>
                        @endif
                    @endif
                </ul>
                {{--操作结束--}}
            </div>
            {{--侧边栏结束--}}

            {{--批量浏览简历列表--}}
            @if(!empty($resumelist) && count($resumelist)>0)
                <div class="browse_resumes">
                    <div class="title">简历库</div>
                    <ul>
                        @foreach($resumelist as $k => $v)
                            <li id="list{{ $k }}" class="resume_name @if($v->id == $id) resumecheck @endif">
                                <a href="{{ $v->url }}">{{ $v->name }}</a>
                            </li>
                        @endforeach
                    </ul>
                    <button class="closeResumes">关闭</button>
                </div>
                <div class="openResumes hide">打开简历库</div>
            @endif
            {{--批量浏览简历列表结束--}}

            {{--基本信息结束--}}
            <div class="content">
                {{--求职意向--}}
                <div class="intention">
                    <h2><span>求职意向</span></h2>
                    <p><span>意向行业</span>{{ $reArr['intentionjobs'] }}</p>
                    <p><span>意向岗位</span>{{ $reArr['jobsort'] }}</p>
                    <p><span>意向地区</span>{{ $reArr['jobarea'] }}</p>
                    <p><span>期望月薪</span>
                        @if($reArr['isexpectedsalary'])面议@else{{ $reArr['expectedsalary'] }}@endif
                    </p>
                    <p><span>求职状态</span>{{ $reArr['job_status'] }}</p>
                </div>
                {{--求职意向结束--}}

                {{--自我评价--}}
                @if(!empty($reArr['introduction']))
                    <div class="assessment">
                        <h2><span>自我评价</span></h2>
                        <div class="section">
                            <p>{!! nl2br(e($reArr['introduction'])) !!}</p>
                        </div>
                    </div>
                @endif
                {{--自我评价结束--}}

                {{--工作经历、教育经历、项目经验--}}
                @if(count($workExpArr) > 0)
                    <div class="experience">
                        <h2><span>工作经历</span></h2>
                        <div class="section">
                            @foreach($workExpArr as $v)
                                <div class="box">
                                    <div class="left"><span>{{$v['starttime']}}-{{$v['endtime']}}</span></div>
                                    <div class="right">
                                        <p><span>{{$v['company']}}</span></p>
                                        <p>
                                            <span class="r_name r_blue">职位：</span>
                                            <span class="r_blue">{{$v['post']}}</span>
                                        </p>
                                        @if(!empty($v['content']))
                                            <p><span class="r_name">职责：</span><span>{{$v['content']}}</span></p>
                                        @endif
                                    </div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--教育经历--}}
                @if(count($eduExpArr) > 0)
                    <div class="experience education">
                        <h2><span>教育培训经历</span></h2>
                        <div class="section">
                            @foreach($eduExpArr as $v)
                                <div class="box">
                                    <div class="left"><span>{{$v['starttime']}}-{{$v['endtime']}}</span></div>
                                    <div class="right">
                                        <p><span>{{$v['school']}}</span></p>
                                        <p>
                                            <span class="r_blue">{{$v['education']}}</span>
                                            @if(!empty($v['education']))<i class="vLine"></i> @endif
                                            <span class="r_blue">{{$v['speciality']}}</span>
                                        </p>
                                    </div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--项目经验--}}
                @if(count($projectExpArr) > 0)
                    <div class="experience projectExp">
                        <h2><span>项目经验</span></h2>
                        <div class="section">
                            @foreach($projectExpArr as $v)
                                <div class="box">
                                    <div class="left"><span>{{$v['starttime']}}-{{$v['endtime']}}</span></div>
                                    <div class="right">
                                        <p><span>{{$v['project_name']}}</span></p>
                                        <p>
                                            <span class="r_name r_blue">担任职位：</span>
                                            <span class="r_blue">{{$v['post']}}</span>
                                        </p>
                                        @if(!empty($v['content']))
                                            <p>
                                                <span class="r_name">项目描述：</span><span>{!! nl2br(e($v['content'])) !!}</span>
                                            </p>
                                        @endif
                                    </div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--工作经历、教育经历、项目经验结束--}}

                {{--语言能力--}}
                @if(count($languageArr) > 0)
                    <div class="ability languages">
                        <h2><span>语言能力</span></h2>
                        <ul class="section">
                            @foreach($languageArr as $v)
                                <li><strong>{{$v['language']}}</strong><i class="vLine"></i>
                                    <span>{{$v['degree']}}</span><span>{{$v['level']}}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                {{--语言能力结束--}}

                {{--技能专长、获得证书--}}
                @if(count($skillArr) > 0)
                    <div class="ability skills">
                        <h2><span>技能专长</span></h2>
                        <ul class="section">
                            @foreach($skillArr as $v)
                                <li>
                                    <strong>{{$v['skillname']}}</strong><i class="vLine"></i>
                                    <span>{{$v['degree']}}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                @if(count($certificateArr) > 0)
                    <div class="ability certificates">
                        <h2><span>获得证书</span></h2>
                        <ul class="section">
                            @foreach($certificateArr as $v)
                                <li>
                                    <strong>{{$v['certificate_name']}}</strong><i class="vLine"></i>
                                    <span class="gotTime">{{$v['gettime']}}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                {{--技能专长、获得证书--}}

                {{--其他--}}
                @if(count($otherArr) > 0)
                    <div class="experience others">
                        <div class="experience others">
                            <h2><span>其它</span></h2>
                            <div class="section">
                                <dl>
                                    @foreach($otherArr as $v)
                                        <dt>{{str_limit($v['title'],8)}}</dt>
                                        <dd><span></span>{!! nl2br(e($v['content'])) !!}</dd>
                                    @endforeach
                                </dl>
                            </div>
                        </div>
                        @endif
                        {{--其他--}}
                        {{--我的作品--}}
                        @if(count($worksArr) > 0)
                            <div class="myWorks">
                                <h2><span>我的作品</span></h2>
                                <div class="sliderBox swiper-container">
                                    <ul class="play-mid-list swiper-wrapper">
                                        @foreach($worksArr as $v)
                                            <li id="liCon{{$v['id']}}" class="swiper-slide swiper-no-swiping">
                                                <input type="hidden" value="{{$v['id']}}">
                                                <input type="hidden" value="{{$v['works_name']}}">
                                                <input type="hidden" value="{{$v['description']}}">
                                                <img src="{{$v['imgurl']}}" width="265" height="185"
                                                     data-id="{{$v['id']}}">
                                                <span>{{$v['works_name']}}</span>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                                <div class="play-mid-btn play-mid-BL"></div>
                                <div class="play-mid-btn play-mid-BR"></div>
                            </div>
                        @endif
                        {{--我的作品结束--}}
                    </div>
                    {{--主要内容-简历信息结束--}}
            </div>
        </div>
        {{--主要内容--}}
        @endsection

        {{--简历详情页js--}}
        @section('js')
            @parent
            <script type="text/javascript" src="{{ asset('/vendor/swiper/swiper2.7.6.min.js') }}"></script>
            <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.jedate.js") }}"></script>
            <script type="text/javascript" src="{{ asset('/default/js/jquery/jquery.form.js') }}"></script>
            <script type="text/javascript" src="{{ asset("/new/js/index/ejectlogin.js") }}"></script>
            <script type="text/javascript" src="{{ asset("/new/js/index/interview.js") }}"></script>
            <script type="text/javascript" src="{{ asset("/new/js/index/insertPersonnelLibrary.js") }}"></script>

            <script>
                var photoJson = {!! $photoJson !!};
                $(function () {
                    //搜索栏中搜索条件选择
                    $('.logoAndSearch select.select').select();

                    @if(count($worksArr) > 0)
                    @foreach($worksArr as $k => $v)
                    //查看图片
                    $('#liCon' + {{$v['id']}} +' img').on('click', function () {
                        var imgId = $(this).attr('data-id');
                        rotateImg(photoJson[imgId]);
                    });
                    @endforeach
                    @elseif(count($worksArr) > 3)
                    //创建轮播图
                    var mySwiper = new Swiper('.myWorks .swiper-container', {
                        autoplay: false,//可选选项，自动滑动
                        loop: true,//可选选项，开启循环
                        slidesPerView: 3, //同时显示的slides数量
                        noSwiping: true, //使该slide无法用鼠标点击滑动
                        onFirstInit: function () {
                            //swiper-slide鼠标事件
                            $('.myWorks .swiper-slide').mouseenter(function () {//鼠标移上
                                mySwiper.stopAutoplay();
                                $('.myWorks .play-mid-btn').show();
                                //鼠标移开
                                $(this).mouseleave(function () {//鼠标移开
                                    mySwiper.startAutoplay();
                                    $('.myWorks .play-mid-btn').hide();
                                });
                            });
                            //前进后退按钮鼠标事件
                            $('.myWorks .play-mid-btn').mouseenter(function () {//鼠标移上
                                mySwiper.stopAutoplay();
                                $('.myWorks .play-mid-btn').show();
                                $(this).click(function () {//鼠标点击
                                    if ($(this).hasClass('play-mid-BL')) {
                                        mySwiper.swipePrev();
                                    } else {
                                        mySwiper.swipeNext();
                                    }
                                });
                                $(this).mouseleave(function () {//鼠标移开
                                    mySwiper.startAutoplay();
                                });
                            });
                        }
                    });
                    @endif

                    //图片展示
                    function rotateImg(photoJson) {
                        layer.photos({
                            photos: {
                                "title": '', //相册标题
                                "id": '', //相册id
                                "start": 0, //初始显示的图片序号，默认0
                                "data": photoJson
                            },
                            //显示关闭按钮
                            closeBtn: 2,
                            area: 'auto',
                            //设置最大宽度
                            maxWidth: '700',
                            //是否显示拖拽
                            move: false,
                            //设置图片信息
                            tab: function (pic, layero) {
                                //console.log(pic) //当前图片的一些信息
                                $('.layui-layer-content').css({'border': '1px solid #444', 'padding': '10px'});
                            },
                            shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
                        });
                    }

                    //轮播图结束

                    //查看联系方式登录按钮
                    $(".baseInfo .companylogin").click(function () {
                        $.companyEject({
                            className: "companylogin",
                            csrf: "{{ csrf_token() }}",
                            weiXinUrl: "{{ weiXinlogin('company') }}",
                            callBack: function (status) {
                                //alert(status);//422 密码错误，0成功，但目前做了 reload
                            }
                        });
                    });
                    //面试邀请登录按钮
                    $(".aside .companylogin2").click(function () {
                        $.companyEject({
                            className: "companylogin2",
                            csrf: "{{ csrf_token() }}",
                            weiXinUrl: "{{ weiXinlogin('company') }}",
                            callBack: function (status) {
                            }
                        });
                    });
                    //纳入人才库登录按钮
                    $(".aside .companylogin3").click(function () {
                        $.companyEject({
                            className: "companylogin3",
                            csrf: "{{ csrf_token() }}",
                            QQLogin: "{{ Site::get('CompanyAppid') }}",
                            weiXin: "{{ Site::get('mpCompanyOpenAppID') }}",
                            weiXinUrl: "{{ weiXinlogin('company') }}",
                            callBack: function (status) {
                            }
                        });
                    });
                    //绑定查看联系方式
                    $(".baseInfo .detail2 .seeContact .button1").click(function () {
                        $.getContact({
                            userName: "{{ $reArr['name']}}",
                            url: "{{url('company/personcontact')}}",
                            crsf: "{{csrf_token()}}",
                            resumeId: "{{ $reArr['id'] }}",
                            callBack: function (status) {
                                //alert(status);//0您的简历数已用尽，1显示联系方式成功2您的会员时间已过期
                            }
                        });
                    });
                    //绑定面试邀请框
                    $(".aside .button2").click(function () {
                        $.interview({
                            userName: "{{ $reArr['name']}}",
                            url: "{{url('company/inviteinterview')}}",
                            interviewUrl: "{{url('company/interviewnote')}}",
                            postJobUrl: "{{ url("company/jobpublish") }}",
                            crsf: "{{csrf_token()}}",
                            resumeId: "{{ $reArr['id'] }}",
                            callBack: function (status) {
                                //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                            }
                        });
                    });
                    //绑定纳入人才库
                    $(".aside .button3").click(function () {
                        $.insertPersonnelLibrary({
                            userName: "{{ $reArr['name']}}",
                            url: "{{ route('toShowCompanyJobList') }}",
                            personnelLibraryUrl: "{{ route('insertPersonnelLibrary')}}",
                            postJobUrl: "{{ url("company/jobpublish") }}",
                            delPersonnelLibrary: "{{ route("delPersonnelLibrary") }}",
                            crsf: "{{csrf_token()}}",
                            resumeId: "{{ $reArr['id'] }}",
                            callBack: function (status) {
                                //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                            }
                        });
                    });
                    //简历下载
                    $(".aside .resumeDown").click(function () {
                        window.location.href = "{{ route("resume.down",[$reArr['id']]) }}";
                    });
                    //询问是否购买简历数
                    $(".aside .resumeBuy").click(function () {
                        resumeBuy = layer.confirm('您的会员已到期或简历数已用尽', {
                                btn: ['重新购买套餐', '稍候再买'] //按钮
                            },
                            function () {//success
                                //跳转到vip套餐页面
                                window.open("{{ route("myOrder.index") }}", "_blank");
                                layer.close(resumeBuy);
                                orderBuy = layer.confirm('已重新购买套餐？', {
                                        btn: ['是', '稍候再买'] //按钮
                                    }, function () {
                                        window.location.reload();
                                    },
                                    function () {
                                        layer.close(orderBuy);
                                    }
                                );
                            },
                            function () {//false
                                layer.close(resumeBuy);
                            }
                        );
                    });

                    //如果有批量浏览简历导航栏，则执行下面操作
                    if ($('.browse_resumes').length > 0) {
                        $('.closeResumes').click(function () {
                            $(this).parent().slideUp(500, function () {
                                $('.openResumes').slideDown(500).click(function () {
                                    $(this).slideUp(500).siblings('.browse_resumes').slideDown(500);
                                });
                            });
                        });
                    }

                });
            </script>
@endsection